Mastering HTML5 by Smashing Magazine

Mastering HTML5 by Smashing Magazine

Author:Smashing Magazine
Language: eng
Format: epub
Tags: Smashing eBooks
Published: 2012-07-16T16:00:00+00:00


This reduces the execution of this function down to 200 ms.

Extreme Optimization

An attentive user would notice that the stage curtains are red. In other words, the image data is defined in the red channel only. The green and blue ones are empty, so there’s no need for them in the calculations:

for (var i = 0, il = pixels.length; i < il; i += 4) {

// generate "noise" pixel

var color = Math.random();

origR = pixels[i]

// Calculate the target color in Multiply blending mode without alpha composition

r = origR * color;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.